<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="mailbox row">
	<div class="col-xs-12">
		<div class="box box-solid">
			<div class="box-body">
				<div class="row">
					
					<div class="col-md-4"></div>
					<div class="col-md-4">
					<!-- --------- 表单信息 start ------------- -->
						<form id="deptForm" role="form" action="" method="post">
						
                           <div class="box-body">
                               <div class="form-group">
                                   <label for="InputName">部门名:</label>
                                   <input name="name" type="text" class="form-control" id="InputName" value="${dept.name }" >
                               </div>
                               <div class="form-group">
                                   <label for="InputDescription">描述:</label>
                                   <input name="description" type="text" class="form-control" id="InputDescription" value="${dept.description}">
                               </div>
                               <input id="deptId" name="id" type="hidden" value="${dept.id }"/><!-- 用于编辑 -->
                               <input name="status" type="hidden" value="${dept.status}"/><!-- 用于编辑 -->
								<!-- ---------id 和  Status 在编辑时加载  才赋值 ------------- -->
	                           <div class="box-footer">
	                              <button id="btn" type="button" class="btn btn-primary">保存</button>
	                           </div>
                           </div>
                       </form>
                       <script type="text/javascript">
                       	$(function(){
                       		$("#btn").click(function(){
                       			if($("#deptId").val()!=""){
                       				$("#deptForm").attr("action","${initParam.root}/department-edit");
                       			}else{
                       				$("#deptForm").attr("action","${initParam.root}/department-add");
                       			}
                       			$("#deptForm").submit();
                       		})
                       	})
                       </script>
                       <!-- --------- 表单信息 end ------------- -->
					</div>
					<div class="col-md-4"></div>
				</div>
				<!-- /.row -->
			</div>
		</div>
		<!-- /.box -->
	</div>
	<!-- /.col (MAIN) -->
</div>
<!-- MAILBOX END -->